/*
@Time : 2019/2/26 0026 19:10
@Author : visons
*/
package dbop

import (
	"gitee.com/visons/gopkg/log"
	"gitee.com/visons/web-model/service"
	"gitee.com/visons/web-model/table"
)

func GetGoodsById(id int) (*table.Goods, error) {
	db := service.NewMysqlDB().GetDB()
	goods := &table.Goods{}
	if err := db.Where("goods_id = ?", id).First(goods).Error; err != nil {
		log.Errorf("select user %d : %s", id, err)
		return nil, err
	}
	return goods, nil
}
